import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooUserHasGroupController } from '../../../controllers';
const uctoouserHasGroupRouter = new Router();
const userHasGroupController = new uctooUserHasGroupController();

uctoouserHasGroupRouter.post('/add', requireUser, userHasGroupController.add);
uctoouserHasGroupRouter.post('/edit', requireUser, rowLevelPermission('uctoo/user_has_group'), userHasGroupController.edit);
uctoouserHasGroupRouter.post('/del', requireUser, rowLevelPermission('uctoo/user_has_group'), userHasGroupController.delete);

//For getting userHasGroup with permission control
uctoouserHasGroupRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/user_has_group'), userHasGroupController.getSingle);
uctoouserHasGroupRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/user_has_group'), userHasGroupController.getMany);
uctoouserHasGroupRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/user_has_group'), userHasGroupController.getMany);

//#endregion AutoCreateCode
uctoouserHasGroupRouter.post('/connect', requireUser, userHasGroupController.connect);
export default uctoouserHasGroupRouter;
